package com.yy.train.ticket.train.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;


import com.yy.train.ticket.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.yy.train.ticket.train.entity.TuRideEntity;
import com.yy.train.ticket.train.service.TuRideService;





/**
 * 乘坐站点
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2023-09-25 10:38:44
 */
@RestController
@RequestMapping("tu/ride")
public class TuRideController {
    @Autowired
    private TuRideService tuRideService;

    /**
     * 列表
     */
    @PostMapping("/list")
    public R list(@RequestParam Map<String, Object> params){


        return R.ok();
    }


    /**
     * 信息
     */
    @GetMapping("/info/{rideId}")
    public R info(@PathVariable("rideId") Long rideId){
		TuRideEntity tuRide = tuRideService.getById(rideId);

        return R.ok(tuRide);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody TuRideEntity tuRide){
		tuRideService.save(tuRide);

        return R.ok();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    public R update(@RequestBody TuRideEntity tuRide){
		tuRideService.updateById(tuRide);

        return R.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    public R delete(@RequestBody List<Integer> rideIds){
		tuRideService.removeByIds(rideIds);

        return R.ok();
    }

}
